import 'package:flutter/foundation.dart';

class VideoSeries {
  static Map<String, List<String>> generate(typeId, voPlayUrlList, index) {
    var voInfo = voPlayUrlList[index];
    var guide = voPlayUrlList.first;
    Map<String, List<String>> dict = {
      "names": [],
      "urls": [],
    };
    switch (typeId) {
      case 1:
        var movieInfo = voInfo.split('\$');
        dict['names'] = [movieInfo[0]];
        dict['urls'] = [movieInfo[1]];
        if (kDebugMode) {
          print('\n=== _video movieInfo: $movieInfo ===\n');
        }
      case 2:
        List<String> tvInfo = voInfo.split('#');
        for (var element in tvInfo) {
          var tv = element.split('\$');
          dict['names']?.add(tv[0]);
          dict['urls']?.add(tv[1]);
        }

        if (kDebugMode) {
          print('\n=== _video tv tvInfo length : ${tvInfo.length} ===\n');
        }
      case 3:
        var varietyInfo = guide.split('#');
        for (var element in varietyInfo) {
          var tv = element.split('\$');
          dict['names']?.add(tv[0]);
          dict['urls']?.add(tv[1]);
        }
        if (kDebugMode) {
          print('\n=== _video varietyInfo length: ${varietyInfo.length} ===\n');
        }
      case 4:
        var comicsInfo = voInfo.split('#');
        for (var element in comicsInfo) {
          var tv = element.split('\$');
          dict['names']?.add(tv[0]);
          dict['urls']?.add(tv[1]);
        }
        if (kDebugMode) {
          print('\n=== _video comicsInfo length: ${comicsInfo.length} ===\n');
        }
      case 25:
        var dramaInfo = voInfo.split('#');
        for (var element in dramaInfo) {
          var tv = element.split('\$');
          dict['names']?.add(tv[0]);
          dict['urls']?.add(tv[1]);
        }
        if (kDebugMode) {
          print('\n=== _video dramaInfo length: ${dramaInfo.length} ===\n');
        }
      case 26:
        var shortInfo = voInfo.split('#');
        for (var element in shortInfo) {
          var tv = element.split('\$');
          dict['names']?.add(tv[0]);
          dict['urls']?.add(tv[1]);
        }
        if (kDebugMode) {
          print('\n=== _video shortInfo length: ${shortInfo.length} ===\n');
        }
    }

    return dict;
  }
}
